<?php
require_once("taskpointView.php");
require_once(CORE_DIR.'taskpointModel.php');

class getAction extends authAction{

	function __construct(){
		$this->view = new taskpointView();
	}

	public function run($get, $post, $viewtype) {
		parent::run($get,$post,$viewtype);
		
		$tpModel = new taskpointModel();	 	
		
		if ( isset($get["taskid"]) || isset($get["pointid"]) )
		{
			$taskID = (isset($get["taskid"]))? $get["taskid"] : -1;
			$pointTypeID = (isset($get["pointid"]))? $get["pointid"] : -1;
			
			if ($taskID != -1 && $pointTypeID != -1)
				$taskPoints = $tpModel->getTaskPointByTaskIdAndTypeID($pointTypeID, $taskID);
			elseif ($taskID != -1)
				$taskPoints = $tpModel->getTaskPointByTaskId($taskID);
			else
				$taskPoints = $tpModel->getTaskPointByTypeID($pointTypeID);
		
			$this->view->setProperty("taskPoints", $taskPoints);
			$this->view->showGetTaskPoints();
		}
		else
		{
			$this->view->showBadCmd();
		}
		
	}
}
?>